package com.waterdrop.wlsggk.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.waterdrop.wlsggk.mapper.InventoryMapper;
import com.waterdrop.wlsggk.pojo.Inventory;
import com.waterdrop.wlsggk.service.IInventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 库存总量Service业务层处理
 *
 * @author Naruto
 * @date 2023-10-21
 */
@Service
public class InventoryServiceImpl implements IInventoryService {

    @Autowired
    private InventoryMapper inventoryMapper;

    /**
     * 查询库存总量
     *
     * @param totalId 库存总量主键
     * @return 库存总量
     */
    @Override
    public Inventory selectInventoryByTotalId(Long totalId) {
        return inventoryMapper.selectInventoryByTotalId(totalId);
    }

    /**
     * 查询库存总量列表
     *
     * @param inventory 库存总量
     * @return 库存总量
     */
    @Override
    public List<Inventory> selectInventoryList(Inventory inventory) {
        return inventoryMapper.selectInventoryList(inventory);
    }

    /**
     * 新增库存总量
     *
     * @param inventory 库存总量
     * @return 结果
     */
    @Override
    public int insertInventory(Inventory inventory) {
        return inventoryMapper.insertInventory(inventory);
    }

    /**
     * 修改库存总量
     *
     * @param inventory 库存总量
     * @return 结果
     */
    @Override
    public int updateInventory(Inventory inventory) {
        inventory.setUpdateTime(DateUtils.getNowDate());
        return inventoryMapper.updateInventory(inventory);
    }

    /**
     * 批量删除库存总量
     *
     * @param totalIds 需要删除的库存总量主键
     * @return 结果
     */
    @Override
    public int deleteInventoryByTotalIds(Long[] totalIds) {
        return inventoryMapper.deleteInventoryByTotalIds(totalIds);
    }

    /**
     * 删除库存总量信息
     *
     * @param totalId 库存总量主键
     * @return 结果
     */
    @Override
    public int deleteInventoryByTotalId(Long totalId) {
        return inventoryMapper.deleteInventoryByTotalId(totalId);
    }
}
